#include <iostream>
#include <cstdlib>
#include <string>
#include <list>
#include <algorithm>
#include <iterator>
#include <sstream>


template<class _Cty,class _Ty>
std::list<_Ty> split(std::basic_string<_Cty>& str,const char delim,const _Ty& constructor){

	std::basic_stringstream<_Cty> transfert;

	list<_Ty> ret;
	list<_Ty>::iterator it;

	unsigned int nb_word = 0;
	unsigned int pos = 0;

	while((pos = str.find(delim,pos+1)) != string::npos){
		str.at(pos) = ' ';
		nb_word++;
	}

	ret.resize(nb_word);

	it = ret.begin();

	transfert<<str;

	for(unsigned int i=0;i<nb_word;i++,it++)
		transfert>>(*it);

	return ret;
}



using namespace std;

int main(int argc,char*argv[]){

	std::string titi("8.8;8.7;8.6;");

	list<float> ret;

	ret = split(titi,';',float());
	
	cout<<ret.size()<<endl;

	cout<<endl;

	copy(ret.begin(),ret.end(),ostream_iterator<float>(cout," "));
	cout<<endl;

#ifdef _WIN32
	system("pause");
#endif

	return EXIT_SUCCESS;

}